package com.gtenacg.fileservice.response;

import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.http.HttpStatus;

/**
 * 统一响应类
 * */
@Data
@AllArgsConstructor
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    public static Result error(String msg) {
        return new Result(HttpStatus.BAD_REQUEST.value(), msg, null);
    }

    public static Result success(Object data) {
        return new Result(HttpStatus.OK.value(), "success", data);
    }

    public static Result success() {
        return success(null);
    }

}
